//package com.Jshop.order.config;
//
//import com.alibaba.druid.pool.DruidDataSource;
//import io.seata.rm.datasource.DataSourceProxy;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import javax.sql.DataSource;
//
//@Configuration
//public class DataSourceProxyConfig {
//
//    /**
//     * @Description //普通数据源
//     * @Param []
//     * @return javax.sql.DataSource
//     * @Date  2021/11/13
//     **/
//    @Bean
//    @ConfigurationProperties(prefix = "spring.datasource")
//    public DataSource dataSource() {
//        return new DruidDataSource();
//    }
//
//    /**
//     * @Description //代理数据源 绑定undolog的操作
//     * @Param [dataSource]
//     * @return io.seata.rm.datasource.DataSourceProxy
//     * @Date  2021/11/13
//     **/
//    @Bean
//    public DataSourceProxy dataSourceProxy(DataSource dataSource) {
//        return new DataSourceProxy(dataSource);
//    }
//
//    /**
//     * @Description //Mybatis 数据源
//     * @Param [dataSourceProxy]
//     * @return org.apache.ibatis.session.SqlSessionFactory
//     * @Date  2021/11/13
//     **/
//    @Bean
//    public SqlSessionFactory sqlSessionFactoryBean(DataSourceProxy dataSourceProxy) throws Exception {
//        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
//        sqlSessionFactoryBean.setDataSource(dataSourceProxy);
//        return sqlSessionFactoryBean.getObject();
//    }
//}
